import React from 'react';
import { View, TextInput } from 'react-native';
import { Button } from '@ant-design/react-native';
import PropTypes from 'prop-types';
import List from './components/List';
import styles from './styles';

const NoteView = ({
    navigation, noteBookList, getList, setSearchVal, searchVal,
}) => (
    <View>
        <Button
            type="primary"
            style={styles.button}
            onPress={() => { navigation.navigate('创建笔记本', { getList }); }}
        >
            创建笔记本
        </Button>
        <TextInput
            style={{
                height: 45,
                borderWidth: 2,
                color: '#0079FF',
                fontSize: 18,
                borderRadius: 5,
                borderColor: '#9CDCFE',
            }}
            onChangeText={text => setSearchVal(text)}
            value={searchVal}
            placeholder="搜索标题/标签"
        />
        <View>
            <List navigation={navigation} noteBookList={noteBookList} getList={getList} />
        </View>
    </View>
);
NoteView.defaultProps = {
    noteBookList: [],
    getList: () => {},
    setSearchVal: () => {},
    searchVal: '',
};
NoteView.propTypes = {
    noteBookList: PropTypes.arrayOf(PropTypes.any),
    getList: PropTypes.func,
    setSearchVal: PropTypes.func,
    searchVal: PropTypes.string,

};
export default NoteView;
